<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>商品-订单表管理</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <jsp:include page="../com/header.jsp"></jsp:include>
    <script type="text/javascript" src="../../js/comm/listcomm.js"></script>
    <script type="text/javascript" src="orderList.js"></script>
    <script type="text/javascript">
        var contentUrl = root + "cms/order/findOrderNEStatusPage";
        var editUrl = 'orderEdit.jsp?id=';
        var operateUrl = root + 'cms/order/operateOrderByIds';
        var operateStatsUrl = root + 'cms/order/operateOrderStatusById';
        function getfilter() {
            var _jsonFilter = "{";
            if ($("#search_userId").val() && $("#search_userId").val().length > 0) {
                _jsonFilter += "'search_EQ_userId':'" + $("#search_userId").val().replace("'", "\"") + "',";
            }
            if ($("#search_orderNo").val() && $("#search_orderNo").val().length > 0) {
                _jsonFilter += "'search_EQ_orderNo':'" + $("#search_orderNo").val().replace("'", "\"") + "',";
            }
            //自己一个 search_EQ_isService 类型
            _jsonFilter += "'search_EQ_isService':'" + 0 + "',";
            if ($("#search_orderState").val() && $("#search_orderState").val().length > 0) {
                _jsonFilter += "'search_EQ_orderState':'" + $("#search_orderState").val().replace("'", "\"") + "',";
            }
            if ($("#search_orderType").val() && $("#search_orderType").val().length > 0) {
                _jsonFilter += "'search_EQ_orderType':'" + $("#search_orderType").val().replace("'", "\"") + "',";
            }
            if (($("#startTime").val() && $("#startTime").val().length > 0) && $("#endTime").val() <= 0) {
                _jsonFilter += "'search_GT_createTime':'" + $("#startTime").val() + "',";
            }
            if (($("#endTime").val() && $("#endTime").val().length > 0) && $("#startTime").val().length <= 0) {
                _jsonFilter += "'search_LT_createTime':'" + $("#endTime").val() + "',";
            }
            if (($("#endTime").val() && $("#endTime").val().length > 0) && ($("#startTime").val() && $("#startTime").val().length > 0)) {
                _jsonFilter += "'search_BETWEEN_createTime':'" + $("#startTime").val() + "," + $("#endTime").val() + "',";
            }
            if (_jsonFilter != "{") {
                _jsonFilter = _jsonFilter.substring(0, _jsonFilter.length - 1);
            }
            _jsonFilter += "}";
            return _jsonFilter;
        }
    </script>
</head>
<body>
<section>
    <div>
        <div class="col-xs-12">
            <div class="box">
                <form id="search_form" class="form-horizontal">
                    <div class="tabSelect" id="selectHeadId">
                        <br>
                        <div class="form-group  col-md-3 search-form">
                            <label class="col-md-4 control-label controls">订单编号：</label>
                            <div class="col-md-8">
                                <input type="text" placeholder="订单编号" class="form-control input-sm" id="search_orderNo"
                                       name="orderNo"/>
                            </div>
                        </div>
                        <div class="form-group  col-md-3 search-form">
                            <label class="col-md-4 control-label controls">用户id：</label>
                            <div class="col-md-8">
                                <input type="text" placeholder="用户id" class="form-control input-sm" id="search_userId"
                                       name="userId"/>
                            </div>
                        </div>
                        <div class="form-group  col-md-3 search-form">
                            <label class="col-md-4 control-label controls">下单时间：</label>
                            <div class="col-md-8" style="padding-right:0;position:relative;">
                                <div class="datetime_clear"></div>
                                <input type="text" placeholder="开始时间" readOnly class="form-control input-sm"
                                       id="startTime" name="createTime"/>
                            </div>
                        </div>
                        <div class="form-group  col-md-3 search-form">
                            <label class="col-md-1 control-label controls">至</label>
                            <div class="col-md-8" style="padding-right:0;position:relative;">
                                <div class="datetime_clear"></div>
                                <input type="text" placeholder="结束时间" readOnly class="form-control input-sm"
                                       id="endTime" name="createTime"/>
                            </div>
                        </div>
                        <div class="form-group  col-md-3 search-form">
                            <label class="col-md-4 control-label controls">订单状态：</label>
                            <div class="col-md-8">
                                <select class="form-control input-sm" id="search_orderState" name="orderState">
                                    <option value="">请选择</option>
                                    <option value="0">未支付</option>
                                    <option value="1">待发货</option>
                                    <option value="2">待收货</option>
                                    <option value="3">待评价</option>
                                    <option value="4">交易完成</option>
                                    <option value="5">交易关闭</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group  col-md-3 search-form">
                            <label class="col-md-4 control-label controls">订单类型：</label>
                            <div class="col-md-8">
                                <select class="form-control input-sm" id="search_orderType" name="orderType">
                                    <option value="">请选择</option>
                                    <option value="1">普通商品</option>
                                    <option value="2">兑换商品</option>
                                    <option value="3">玩 /达人/作品/艺术品</option>
                                </select>
                            </div>
                        </div>
                        <input type="button" value="查询" id="search" class="btn btn-primary searchBtn">
                    </div>
                </form>
                <div class="box-body table-responsive" style="clear:both;">
                    <input type="button" value="查看" id="lookSome" class="btn btn-color">
                    <input type="button" value="发货" id="addGoods" class="btn btn-color">
                    <input type="button" value="导出" id="dataexport" class="btn btn-color">
                </div>
                <div class="box-body table-responsive">
                    <table id="example2" class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th width="30"><input type="checkbox" id="_selectAll"/></th>
                            <th width="80">主订单编号</th>
                            <th width="80">订单总价</th>
                            <th width="80">订单类型</th>
                            <th width="80">联系人</th>
                            <th width="80">手机号</th>
                            <th width="80">订单状态</th>
                            <th width="80">下单时间</th>
                        </tr>
                        </thead>
                        <!-- 表格内容 start -->
                        <tbody id="mycontent"></tbody>
                        <!-- 表格内容 end -->
                    </table>
                    <!-- 分页标签 start -->
                    <div class="row page_big_div" id="displayPage"></div>
                    <!-- 分页标签 end -->
                    <script id="tableContentTmple" type="text/x-jsrender">
								<tr>
								    <td><input id="ck_{{:id}}" ckId="{{:id}}"  ckOrderNo="{{:orderNo}}" ckType="{{:orderType}}" ckOrderStatus="{{:orderState}}" class="ckSelect" type="checkbox" /></td>
									<td>{{:orderNo}}</td>
									<td title={{:orderTotalPirce}} style="vertical-align:middle; text-align:right;">{{toThousands:orderTotalPirce}}</td>
									<td style="vertical-align:middle; text-align:left;">{{if orderType == 1}}普通商品{{else orderType == 2}}兑换商品{{else orderType == 3}}玩 /达人/作品/艺术品{{else orderType==51}}住{{else orderType==52}}机构参观{{else orderType==53}}旅游/游学{{else orderType==54}}旅护理培训|培训义工{{/if}}</td>
									<td>{{:consigneeName}}</td>
									<td>{{:consigneeTel}}</td>
									<td style="vertical-align:middle; text-align:left;">{{if orderState == 0}}待支付{{else orderState == 1}}已支付{{else orderState == 2}}待收货{{else orderState==3}}待评价{{else orderState==4}}交易完成{{else orderState==5}}交易关闭{{/if}}</td>
									<td>{{:createTime}}</td>
								</tr>


                    </script>
                </div>
            </div>
        </div>
</section>
<!-- 发货编辑弹出框 -->
<div class="modal fade" id="sentGoods" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <form id="sentvalidateForm" class="form-horizontal">
        <div class="modal-dialog">
            <div class="modal-content"  style="background-color: #fff;height: 300px;width: 518px;">
                <div class="modal-header">
                    <button type="button" class="close back" data-dismiss="modal"
                            aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel_sentGoods">发货内容</h4>
                </div>
                <div class="form-group  col-md-9 search-form" style="width: 400px;">
                    <label class="col-md-4 control-label controls" style="margin-top: 50px;">选择物流：</label>

                    <div class="col-md-8" style="margin-top: 46px;">
                        <div style="color:#FF0000;font-size:15px;margin-top:5px;float:right">*</div>
                        <select class="form-control input-sm" id="expressCompany" name="expressCompany"
                                style="width: 200px;height: 35px;">
                            <option value="">请选择</option>
                            <script id="expressCompanyContentTmple" type="text/x-jsrender">
                            {{for object}}
                                <option value="{{:#data}}"  title="{{:#data}}">{{:#data}}</option>
                            {{/for}}
                        </script>
                        </select>

                    </div>
                </div>
                <div class="form-group  col-md-9 search-form" style="width: 400px;margin-top: -25px;">
                    <label class="col-md-4 control-label controls" style="margin-top: 50px;">运单号：</label>

                    <div class="col-md-8" style="margin-top: 46px;">
                        <div style="color:#FF0000;font-size:15px;margin-top:5px;float:right">*</div>
                        <input type="text" placeholder="运单号" data-rule="required;length[5~]" class="form-control input-sm"
                               style="width: 200px;height: 35px;" id="expressNumber" name="expressNumber" value=""/>

                    </div>
                </div>
                <div class="box-header" style="padding:170px 90px 0px 90px;background-color: #fff;width: 500px;">
                    <br>
                    <input type="button" value="确定" id="sent" class="btn btn-success">
                    <button type="button" class="btn btn-primary back" data-dismiss="modal" aria-hidden="true"
                            style="margin-left: 70px;">返回
                    </button>
                </div>
            </div>
        </div>
    </form>
</div>
<!-- 查看详情弹出框 -->
<div class="modal fade" id="orderDetailModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <form id="validateForm" class="form-horizontal">
        <div class="modal-dialog">
            <div class="modal-content" style="width:800px;margin-left:-100px;">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">查看详情</h4>
                </div>
                <div class="modal-body" id="detail_content">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </form>
</div>
<script id="detailContentTmple" type="text/x-jsrender">
			{{for object}}
			<div class="form-group">
						<label for="userPhoto2" class="control-label col-md-2">{{:key1}}</label>
			    		<div class="controls col-md-3" style="line-height:30px;font-weight:normal;">
							{{:val1}}
						</div>
						<label for="userPhoto2" class="control-label col-md-2">{{:key2}}</label>
						<div class="controls col-md-3" style="line-height:30px;font-weight:normal;">
							{{:val2}}
						</div>
			</div>
			{{/for}}
</script>
</body>
</html>